home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / etc / init.d / ondemand < prev    next >
Text File  |  2009-09-07  |  882b  |  41 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          ondemand
  4. # Required-Start:    $remote_fs $all
  5. # Required-Stop:
  6. # Default-Start:     2 3 4 5
  7. # Default-Stop:
  8. # Short-Description: Set the CPU Frequency Scaling governor to "ondemand"
  9. ### END INIT INFO
  10.  
  11.  
  12. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  13.  
  14. . /lib/init/vars.sh
  15. . /lib/lsb/init-functions
  16.  
  17. case "$1" in
  18.     start)
  19.         start-stop-daemon --start --background --exec /etc/init.d/ondemand -- background
  20.         ;;
  21.     background)
  22.     sleep 60 # probably enough time for desktop login
  23.  
  24.     for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
  25.     do
  26.         [ -f $CPUFREQ ] || continue
  27.         echo -n ondemand > $CPUFREQ
  28.     done
  29.     ;;
  30.     restart|reload|force-reload)
  31.         echo "Error: argument '$1' not supported" >&2
  32.         exit 3
  33.         ;;
  34.     stop)
  35.         ;;
  36.     *)
  37.         echo "Usage: $0 start|stop" >&2
  38.         exit 3
  39.         ;;
  40. esac
  41.